﻿using GUI.Models;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;

namespace GUI.Controllers
{
    public class ImagesController : Controller
    {
        //

        [HttpGet]
        public ActionResult Upload()
        {

            return View();


        }
        [HttpPost]
        public ActionResult Upload(HttpPostedFileWrapper ImageUploaded)
        {
            if(ModelState.IsValid)  
            {

                string fileName = Guid.NewGuid().ToString() + "_Art";
                Session["fileNameSession"] = fileName;
                string serverPath = Server.MapPath("~");
                string imagesPath = serverPath + "Images\\ImageArticle\\";
                string thumbPath = imagesPath + "Thumb\\";
                string fullPath = imagesPath + "Full\\";

                ImageUploaded.SaveAs((System.IO.Path.Combine(fullPath, Session["fileNameSession"] + ".JPEG")));
              
                
              
            }
            return View();
        }
        
      
    }
}
